package es

import (
	"github.com/elastic/go-elasticsearch/v8"
)

var Client *elasticsearch.Client

func InitClient() error {
	cfg := elasticsearch.Config{
		Addresses: []string{"http://localhost:9200"},
		Username:  "tester",
		Password:  "pwd123456",
	}
	client, err := elasticsearch.NewClient(cfg)
	if err != nil {
		return err
	}

	Client = client
	return nil
}
